# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1BackupSchedule do
  @moduledoc """
  A backup schedule for a Cloud Firestore Database. This resource is owned by the database it is backing up, and is deleted along with the database. The actual backups are not though.

  ## Attributes

  *   `createTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp at which this backup schedule was created and effective since. No backups will be created for this schedule before this time.
  *   `dailyRecurrence` (*type:* `GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1DailyRecurrence.t`, *default:* `nil`) - For a schedule that runs daily.
  *   `name` (*type:* `String.t`, *default:* `nil`) - Output only. The unique backup schedule identifier across all locations and databases for the given project. This will be auto-assigned. Format is `projects/{project}/databases/{database}/backupSchedules/{backup_schedule}`
  *   `retention` (*type:* `String.t`, *default:* `nil`) - At what relative time in the future, compared to its creation time, the backup should be deleted, e.g. keep backups for 7 days. The maximum supported retention period is 14 weeks.
  *   `updateTime` (*type:* `DateTime.t`, *default:* `nil`) - Output only. The timestamp at which this backup schedule was most recently updated. When a backup schedule is first created, this is the same as create_time.
  *   `weeklyRecurrence` (*type:* `GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1WeeklyRecurrence.t`, *default:* `nil`) - For a schedule that runs weekly on a specific day.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :createTime => DateTime.t() | nil,
          :dailyRecurrence =>
            GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1DailyRecurrence.t() | nil,
          :name => String.t() | nil,
          :retention => String.t() | nil,
          :updateTime => DateTime.t() | nil,
          :weeklyRecurrence =>
            GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1WeeklyRecurrence.t() | nil
        }

  field(:createTime, as: DateTime)
  field(:dailyRecurrence, as: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1DailyRecurrence)
  field(:name)
  field(:retention)
  field(:updateTime, as: DateTime)

  field(:weeklyRecurrence, as: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1WeeklyRecurrence)
end

defimpl Poison.Decoder, for: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1BackupSchedule do
  def decode(value, options) do
    GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1BackupSchedule.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Firestore.V1.Model.GoogleFirestoreAdminV1BackupSchedule do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
